﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class TextCountDown : MonoBehaviour
{
    public Text textCountdown;
    public RectTransform rect;
    string text1;
    public static TextCountDown Instance { get; private set; }
    // Start is called before the first frame update
    private void Awake()
    {
        Instance = this;
    }
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        
    }

    
    public void SetTime(float num)
    {
        num = (int)(num + 1);            
        if (num < 1)
        {
            rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 239f);
            textCountdown.fontSize = 34;
            text1 = "Spatio-temporal Tunnel Active!";
        }
        else
        {
            rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 350f);
            textCountdown.fontSize = 60;
            text1 = "Time:" + num + 's';
        }
        textCountdown.text = text1;
    }
}
